﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ChartSharp
{
    public class DataScale : ChartParam
    {
        protected IEnumerable<float> _dataSets;

        public override string Name
        {
            get { return "chds"; }
        }

        public override string Data
        {
            get
            {
                StringBuilder builder = new StringBuilder();

                if (_dataSets != null)
                {
                    _dataSets.ToList().ForEach((data) =>
                    {
                        builder.Append(data.ToString("N2"));
                        builder.Append(",");
                    });

                    if (builder.Length > 0)
                    {
                        builder.Length--;
                    }
                }

                return builder.ToString();
            }
        }

        public DataScale(IEnumerable<float> dataSets)
        {
            _dataSets = dataSets;
        }
    }
}
